package com.shujia.base.day04

import scala.io.Source

/**
 * 隐式转换类：只能写在object中
 */
object Demo28Implicit {
  def main(args: Array[String]): Unit = {
//    val demo = new Demo9("hello")
//    demo.fun1()

    "hello".fun1()

    val studentsList: List[String] = "scala/data/students.txt".fun2()
    val scoreList: List[String] = "scala/data/score.txt".fun2()

  }

  //隐式转换类
  implicit class Demo9(s: String) {
    def fun1(): Unit = {
      println("方直是世界上最帅的男人！" + s)
    }

    def fun2():List[String]={
      Source.fromFile(s).getLines().toList
    }
  }
}

